//
//  FreightView.swift
//  Box
//
//  Created by mn on 2025/4/1.
//

import UIKit

struct FreightModel: Codable{
    let success: Bool
    let message: String
    let code: Int
    let data: Int
}


class FreightView: UIView{

    let titleLabel: UILabel = {
        let label = UILabel()
        label.font = UIFont.systemFont(ofSize: 15,weight: .heavy)
        label.textColor = .fromHex("#001C00")
        label.numberOfLines = 2
        label.text = "运费"
        return label
    }()
    
    let priceLabel: UILabel = {
        let label = UILabel()
        label.font = UIFont.systemFont(ofSize: 13,weight: .semibold)
        label.textColor = .init(hex: "#292D32")
        label.text = "￥20.00"
        return label
    }()
    let descLabel: UILabel = {
        let label = UILabel()
        label.font = UIFont.systemFont(ofSize: 12,weight: .medium)
        label.textColor = .init(hex: "#A1A1A1")
        label.numberOfLines = 0
        label.text = "温馨提示：商品在不同仓库时，发货可能会存多个物流账单哦～"
        return label
    }()
    override init(frame: CGRect) {
        super.init(frame: frame)
        setupUI()
    }

    required init?(coder: NSCoder) {
        super.init(coder: coder)
        setupUI()
    }
    
    private func setupUI() {
        backgroundColor = .white

        addSubview(titleLabel)
        addSubview(priceLabel)
        addSubview(descLabel)
        
        titleLabel.snp.makeConstraints { make in
            make.top.equalToSuperview().offset(14.5)
            make.left.equalToSuperview().offset(16)
        }
        
        priceLabel.snp.makeConstraints { make in
            make.centerY.equalTo(titleLabel.snp.centerY)
            make.right.equalToSuperview().offset(-16)
        }
        descLabel.snp.makeConstraints { make in
            make.top.equalTo(titleLabel.snp.bottom).offset(12)
            make.left.equalToSuperview().offset(16)
            make.bottom.lessThanOrEqualToSuperview().offset(-17.5)
        }
    }
}
